package model

import (
	"database/sql"
	"time"
)

type MailMessage struct {
	ResCommon
	Subject     string
	Date        sql.NullTime
	Body        string
	ParentId    sql.NullInt64
	Model       string
	ModelName   int64
	ResId       int64
	RecordName  string
	MessageType string
	SubtypeId   int64
	AuthorId    int64
	Partner     ResPartner `gorm:"foreignKey:Id;references:AuthorId"`
	MessageId   string
	Tracks      []MailTrackingValue `gorm:"foreignKey:MailMessageId"`
}

type MailTrackingValue struct {
	ResCommon
	Field            int64
	FieldType        string
	FieldDesc        string
	OldValueInteger  int
	OldValueFloat    float64
	OldValueMonetary float64
	OldValueChar     string
	OldValueText     string
	OldValueDatetime sql.NullTime
	NewValueInteger  int
	NewValueFloat    float64
	NewValueMonetary float64
	NewValueChar     string
	NewValueText     string
	NewValueDatetime sql.NullTime
	CurrencyId       int64
	MailMessageId    int64
	TrackingSequence int
}

// MailFollowers 关注人员
type MailFollowers struct {
	Id        int64
	ResModel  string
	ResId     int64
	PartnerId int64
	Partner   ResPartner
}

// MailActivityType 活动类型
type MailActivityType struct {
	ResCommon
	Sequence       int
	DelayCount     int
	DelayUnit      string
	DelayFrom      string
	Icon           string
	DecorationType sql.NullString
	ResModel       sql.NullString
	ChainingType   string
	Category       string
	Name           string
	Summary        string
	Active         bool
}

// MailActivity 活动
type MailActivity struct {
	ResCommon
	ResModelId                int64
	Model                     IrModel `gorm:"foreignKey:Id;references:ResModelId"`
	ResId                     int64
	ActivityTypeId            int64
	ActivityType              MailActivityType
	UserId                    int64
	RequestPartnerId          int64
	RecommendedActivityTypeId int64
	PreviousActivityTypeId    int64
	ResModel                  string
	ResName                   string
	Summary                   string
	DateDeadline              time.Time
	Note                      string
	Automated                 bool
	NoteId                    int64
}
